<template>
  <div class="content">
    <div class="title">{{title}}</div>
    <div class="product">
      <div
        class="product-info"
        v-for="(item,index) in items"
        :key="index"
        @click="productClick(item)"
      >
        <!-- <img class="product-icon" v-bind:src="item.goods_image_url" /> -->
        <span class="product-title">{{ item.goods_name }}</span>
        <div class="product-bottom">
          <span class="product-price">￥{{ item.goods_price }}</span>
          <span class="product-buy">{{ item.goods_salenum }}人已购买</span>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  name: "StoreClassBody",
  data() {
    return {};
  },
  props: ["title", "items"],
  created() {
  },
  methods: {
    productClick: function (goodsId) {
      this.$router.push({
        name: "HomeGoodsdetail",
        query: { goods_id: goodsId.goods_id },
      });
    },
  },
};
</script>
<style lang="scss" scoped>
.content .title {
  width: 17.5rem;
  margin: auto;
  padding: 0 0 0.43rem 0;
  color: #101010;
  font-size: 0.7rem;
  text-align: center;
  border-bottom: 1px solid #eeeff2;
}
.product {
  display: flex;
  flex-wrap: wrap;
}
.product-info:nth-of-type(even) {
  padding: 0.7rem 0.5rem 0.5rem 0;
}
.product-info:nth-of-type(add) {
  // background: red;
  padding: 0.5rem 0 0.5rem 0.5rem;
}
.product-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0.5rem 0 0.5rem 0.5rem;
  justify-content: flex-end;
  // border-bottom: 1px solid #f5f5f5;
  width: 50%;
  box-sizing: border-box;
  .product-icon {
    align-self: center;
    width: 8.2rem;
    height: 8.2rem;
    box-sizing: border-box;
    border-radius: 5px;
  }
  .product-title {
    color: #333;
    font-size: 0.6rem;
    margin-top: 0.5rem;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    padding-left: 0.3rem;
  }
  .product-bottom {
    display: flex;
    justify-content: space-between;
    margin-top: 0.4rem;
    line-height: 1rem;
    .product-price {
      color: $primaryColor;
      font-size: 0.7rem;
      padding-left: 0.3rem;
    }
    .product-buy {
      color: #999999;
      font-size: 0.65rem;
      padding-right: 0.3rem;
    }
  }
}
</style>
